package com.cc.blog.web.controller;

import com.cc.blog.common.annotation.ApiOperationLog;
import com.cc.blog.common.utils.Result;
import com.cc.blog.web.domain.dto.FindTagArticlePageListReqDTO;
import com.cc.blog.web.domain.dto.FindTagListReqDTO;
import com.cc.blog.web.service.TagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 标签
 * @Author cc
 * @Date 2024/7/12 10:55
 */
@RestController
@RequestMapping("/tag")
@Api(tags = "标签")
@AllArgsConstructor
public class TagController {

    private final TagService tagService;

    @PostMapping("/list")
    @ApiOperation(value = "前台获取标签列表")
    @ApiOperationLog(description = "前台获取标签列表")
    public Result findTagList(@RequestBody @Validated FindTagListReqDTO findTagListReqDTO) {
        return tagService.findTagList(findTagListReqDTO);
    }

    @PostMapping("/article/list")
    @ApiOperation(value = "前台获取标签下文章列表")
    @ApiOperationLog(description = "前台获取标签下文章列表")
    public Result findTagPageList(@RequestBody @Validated FindTagArticlePageListReqDTO findTagArticlePageListReqDTO) {
        return tagService.findTagPageList(findTagArticlePageListReqDTO);
    }
}
